﻿<!DOCTYPE html>
<html>
<head>
    <title>Mocha</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="mocha.css" />
</head>
<body>
    <div id="mocha"></div>

    <script src="../../scripts/require.js"></script>
    <script>
        requirejs.config({

            paths: {
                chai: '../../scripts/chai',
                q: '../../scripts/q',
                bluebird: '../../scripts/BlueBird',
                jquery: '../../scripts/jquery-2.1.1',
                CrmRestKit: '../../scripts/3.x/TypeScript/CrmRestKit'
            },
            shim: {
                'sinon': {
                    deps: [],

                    exports: 'sinon'
                },
                'mocha': { exports: 'mocha' }
            }
        });

        requirejs(['./mocha', 'jquery'], function (mocha, $) {
            mocha.setup('bdd')

            requirejs([
                './Specs/InterfaceTests',
                './Specs/PromiseTests',
                './Specs/UtilTests',
                './Specs/VerySimplePromiseTests',
            ], function () {


                for (var i = 0; i < arguments.length; i++) {
                    new arguments[i]().run();
                }

                mocha.run();

                createHome($);
            });
        });

        function createHome($) {
            var stat = $('#mocha-stats');
            if (stat.length == 0)
                window.setTimeout(function () { createHome($); }, 100);
            else {
                $('<li></li>').append('<a href="?">Remove filters</a>').insertBefore(stat.children().first());
            }
        }

    </script>
</body>
</html>
